package JAVA300.第十一章多线程;

/**
 * 阻塞状态 join
 * 插队线程
 */

public class thread_11_threadState_blocked_join {
    public static void main(String[] args) throws InterruptedException {
        //join需要对象调 所以不能用匿名
        Thread thread = new Thread(()->{
            for (int i=0;i<100;i++){
                System.out.println("lamda thread"+i);
            }

        });
        thread.start();

        //主线程
        for (int i=0;i<100;i++){
            if (i==20){
                thread.join();//主线程被阻塞
            }
            System.out.println("main thread"+i);

        }

    }
}
